<hmtl>
    <head>
        <style>
            #f1_upload_process{
                z-index:100;
                position:absolute;
                visibility:hidden;
                text-align:center;
                width:400px;
                margin:0px;
                padding:0px;
                background-color:#fff;
                border:1px solid #ccc;
            }
            form{
                text-align:center;
                width:390px;
                margin:0px;
                padding:5px;
                background-color:#fff;
                border:1px solid #ccc;
            }
        </style>
    </head>
    <body>

        <script type="text/javascript">
            function startUpload(){
                document.getElementById('f1_upload_process').style.visibility = 'visible';
                return true;
            }
            function stopUpload(success){
                var result = '';
                if (success == 1){
                    document.getElementById('result').innerHTML =
                        '<span class="msg">The file was uploaded successfully!<\/span><br/><br/>';
                }
                else {
                    document.getElementById('result').innerHTML =
                        '<span class="emsg">There was an error during file upload!<\/span><br/><br/>';
                }
                document.getElementById('f1_upload_process').style.visibility = 'hidden';
                return true;
            }
        </script>
        <p id="f1_upload_process">Loading...<br/><img src="ajax-loader.gif" /></p>

        <p id="result"></p>

        <form action="upload.php" method="post" enctype="multipart/form-data" target="upload_target" onsubmit="startUpload();" >

            File: <input name="myfile" type="file" />

            <input type="submit" name="submitBtn" value="Upload" />

        </form>



        <iframe id="upload_target" name="upload_target" src="#" style="width:0;height:0;border:0px solid #fff;">
            <script language="javascript" type="text/javascript">
                window.top.window.stopUpload(<?php echo $result; ?>);
            </script> 
        </iframe>

    </body>
</html>